import { PageContainer, ProTable } from "@ant-design/pro-components";
import { Button, Modal, Card, Form, Radio, Space } from "antd";
import { connect, useParams } from "umi";
import { namespace, calcColumns } from "./configFile";
import { useEffect, useRef, useState } from "react";
import styles from "./styles.less";

const Page = (props) => {
  const { dispatch, submitLoading } = props;
  const [open, setOpen] = useState(false);
  const [form] = Form.useForm();
  const actionRef = useRef();
  const objData = useParams();
  useEffect(() => {
    dispatch({
      type: `${namespace}/pageInit`,
      params: {
        id: objData.id,
      },
    });
  }, []);

  return (
    <PageContainer className={styles.contentExamDetail}>
      <ProTable
        actionRef={actionRef}
        request={async (params) => {
          return await dispatch({
            type: `${namespace}/queryTable`,
            params,
          });
        }}
        pagination={{
          showSizeChanger: true,
        }}
        scroll={{ x: 1500 }}
        columns={calcColumns({})}
      />
    </PageContainer>
  );
};

export default connect((state) => ({
  ...state[namespace],
  submitLoading: state.loading.effects[`${namespace}/submitItem`],
}))(Page);
